﻿<UserControl x:Class="FileDuplicateUtility.FilterSelector"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:l="clr-namespace:FileDuplicateUtility"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.DataContext>
        <Binding RelativeSource="{RelativeSource Mode=Self}"/>
    </UserControl.DataContext>
    <UserControl.Resources>
        <DataTemplate DataType="{x:Type l:TextFilter}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Text : "/>
                <TextBox Grid.Column="1" VerticalAlignment="Center" Text="{Binding Path=SearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
            </Grid>
        </DataTemplate>
        <DataTemplate DataType="{x:Type l:RegexFilter}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Pattern : "/>
                <TextBox Grid.Column="1" VerticalAlignment="Center" Text="{Binding Path=Pattern, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
            </Grid>
        </DataTemplate>
        <DataTemplate DataType="{x:Type l:Filter}">
            <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap" Text="No Configuration Requred"/>
        </DataTemplate>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        
        <ComboBox Grid.Row="0" ItemsSource="{Binding Path=AvailableFilters, Mode=OneTime}" SelectedItem="{Binding Path=SelectedFilter, Mode=TwoWay}" DisplayMemberPath="Name"/>
        
        <ContentPresenter Grid.Row="1" Margin="0,2,0,0" Content="{Binding Path=SelectedFilter, Mode=OneWay}"/>
        
    </Grid>
</UserControl>
